// throw new Error('API Exception')
// 1需要监听错误  2输出一段有意义的提示信息
const Router = require('koa-router')
const router = new Router()

const { PositiveIntegerValidator } = require('../../validators/validator')

// const { HttpException, ParameterException } = require('../../../core/http-exception')

// router.get('/v1/classic/latest', (ctx, next) => {
//     ctx.body = {
//         key: 'classic'
//     }
// })

router.post('/v1/:id/classic/latest', async (ctx, next) => {
    // 获取 路径变量传参
    // 获取 参数传参
    // 获取 header里的
    // 获取 body里的
    const path = ctx.params
    const query = ctx.query
    const headers = ctx.headers
    const body = ctx.request.body

    // LinValidator
    const v = await new PositiveIntegerValidator().validate(ctx)
    const id = v.get('path.id', parsed=false)
    ctx.body = 'success'

})

module.exports = router